package main

import (
	"fmt"
)

type Monkey struct {
	Name string
}

type BirdAble interface {
	Flying()
}

type FishAble interface {
	Swimming()
}

func (this *Monkey) climbing() {
	fmt.Println(this.Name, "会爬树")
}

type LittleMonkey struct {
	Monkey //继承
}

func (this *LittleMonkey) Flying() {
	fmt.Println(this.Name, "会飞")
}

func (this *LittleMonkey) Swimming() {
	fmt.Println(this.Name, "会游泳")
}

func main() {
	var monkey LittleMonkey = LittleMonkey{
		Monkey{
			Name: "wukong",
		},
	}

	monkey.climbing()
	monkey.Swimming()
	monkey.Flying()

	var b BirdAble = &monkey //类实现了接口，则可以用类创建接口实例
	b.Flying()

}
